<?php if (!defined('THINK_PATH')) exit();?> 
 
<html>
    <head>
        <meta charset="utf-8"> 
        <title>美业红</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">
        <script type='text/javascript' src='/public/js/jquery-1.11.2.min.js'></script>
        <script type="text/javascript" src='/public/js/jquery.validate.js'></script>    
        <link rel="stylesheet" href="/public/css/admin.css">
    </head>
    <body>
        <div class="table-responsive">
            <?php if(!$list){ ?>
            <table  class="table table-striped table-bordered" style=" margin-top:3rem;"  >
                <thead>
                    <tr>
                        <th width="20%">商品编号</th>
                        <th width="10%">商品品牌</th>
                        <th width="20%">商品名称</th>
                        <th width="10%">商品价格</th>
                        <th width="15%">商品分类</th>
                        <th width="15%">商品操作</th>
                    </tr>
                </thead>
                <tbody>
                    <?php  foreach($list as $v){ ?>
                    <tr>
                        <td><?php echo $v['store_name'];?></td>
                        <td><?php echo $v['name'];?></td>
                        <td><?php echo $v['mobile'];?></td>
                        <td><?php echo date('Y-m-d H:i:s',$v['create_time']);?></td>
                        <td><?php echo '&nbsp;&nbsp;&nbsp;<a onClick="info(this);" _id="'.$v['id'].'">商品详情</a><br>&nbsp;&nbsp;&nbsp;<a onClick="create(this);" _id="'.$v['id'].'">商品修改</a><br>&nbsp;&nbsp;&nbsp;<a onClick="delete(this);" _id="'.$v['id'].'">商品下架</a>';?></td>
                    </tr>
                   <?php } ?>
                    <tr><td  colspan=6 align='center'><?php echo $page;?></td><tr>
                </tbody>
            </table>
             <?php  } else{ ?>
                <div style='color:red;margin-top:20rem;text-align:center;' ><h2 >您还没有创建过商品！</h2 ></div>
             <?php } ?>
        </div>
        <script type='text/javascript'>
           

            /*function info(obj){
                if(!confirm("确认操作？")){
                    return;
                }
                var id = $(obj).attr('_id');
                var m = '&mobile='+ $(obj).parent().prev().prev().html();
                var url='/admin/business/dispose?id=';
                    url = url + id+m;
                    $.ajax({
                        url: url,
                        async: true, 
                        success: function (msg) {
                            if(msg == 'true'){
                                alert('处理成功');
                                $(obj).parent().html('审核通过');       
                            }else if(msg=='check'){
                                alert('该手机号已存在！');
                                return;   
                            }else{
                                alert('处理失败');
                            }
                        }
                    });
            }
            function create(obj){
                if(!confirm("确认操作？")){
                    return;
                }
                var id = $(obj).attr('_id');
                var url='/admin/business/disposess?id=';
                    url = url + id;
                    $.ajax({
                        url: url,
                        async: true, 
                        success: function (msg) {
                            if(msg == 'true'){
                                alert('处理成功');
                                $(obj).parent().html('审核未通过');       
                            }else{
                                alert('处理失败');
                            }
                        }
                    });
            }
*/
                    
        </script>
    </body>
</html>